from rest_framework import serializers
from .models import *


class TeacherBaseSerializers(serializers.ModelSerializer):
    # expend = serializers.CharField(source='')
    class Meta:
        model= TeacherBase
        fields="__all__"

class TeacherSchoolSerializers(serializers.ModelSerializer):
    
    class Meta:
        model= TeacherSchool
        fields="__all__"

class TeacherFamilySerializers(serializers.ModelSerializer):
    
    class Meta:
        model= TeacherFamily
        fields="__all__"


class TeacherExpendSerializers(serializers.ModelSerializer):
    showName = serializers.CharField(source='name.name',read_only=True)
    class Meta:
        model= TeacherExpend
        fields="__all__"


class TeacherBaseExpendSerializers(serializers.ModelSerializer):
    
    expend = serializers.SerializerMethodField(method_name='get_expend',read_only=True)

    class Meta:
        model= TeacherBase
        fields="__all__"
    @staticmethod
    def get_expend(obj):
        print(obj.teacherExpend_set)
        # obj.teacherexpend_set.all().values()
        return {'sta':200}